﻿<Workspace
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"
  xmlns="clr-namespace:agree;assembly=agree-sys"
  xmlns:semi="clr-namespace:agree.semi;assembly=agree-sys">

    <Workspace.DefaultDirectories>
        <StringItem>grammars</StringItem>
        <StringItem>grammars\thai</StringItem>
        <StringItem>grammars\thai\lkb</StringItem>
        <StringItem>grammars\erg</StringItem>
    </Workspace.DefaultDirectories>

    <StringCorpus x:Name="test_sentences">

        <Item xml:lang="th" ItemEnable="False" Text="เด็ก เล็ก กิน ข้าว" ItemStatus="Grammatical">
            <Item.Translations>
                <Item xml:lang="en" Text="The small child is eating." />
            </Item.Translations>
        </Item>

        <Item xml:lang="th" ItemEnable="False" Text="แมว นอน" ItemStatus="Grammatical">
            <Item.Translations>
                <Item xml:lang="en" Text="The cat is sleeping." />
            </Item.Translations>
        </Item>

        <Item xml:lang="th" ItemEnable="False" Text="ฝน ตก" ItemStatus="Grammatical">
            <Item.Translations>
                <Item xml:lang="en" Text="It's raining." />
            </Item.Translations>
        </Item>

    </StringCorpus>

    <!--<StringCorpus x:Name="sentences_575" Items="{TextFileLoader grammars\\thai\\complete-sentences-spaced.txt}" />-->
    <!--, 63, 1-->
    <!--, 50, 1-->
    <!-- , 15, 10  -->

    <XamlLoadInstance x:Name="bitext_sentences" Filename="grammars\thai\tla.xml" />

    <!-- ===================================================================================================================== -->

    <PathRef x:Name="thai" Path="RootElement.NameScope[thai]">
        <XamlLoadInstance Filename="configs\thai.xml" />
    </PathRef>

    <Sequence x:Name="parse_th">

        <WhitespaceSplitterF />

        <Factory x:TypeArguments="OrthLexentLookup">
            <Setter Property="{x:Static P.Lexicon}" Value="{PathRef {x:Reference thai}, EntryMgr.Lexicon}" />
        </Factory>

        <Factory x:TypeArguments="FindChartobjCoverage" />

        <Factory x:TypeArguments="ParseControl">
            <Setter Property="{x:Static P.AgreeConfig}" Value="{PathRef {x:Reference thai}, AgreeConfig}" />
            <Setter Property="{x:Static P.ChartConfig}" Value="{PathRef {x:Reference thai}, AgreeConfig.Parser.Chart}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference thai}, TfsUnifier}" />
            <Setter Property="{x:Static P.ChartStartSymbols}" Value="{PathRef {x:Reference thai}, EntryMgr.ParserStartSymbols}" />
            <Setter Property="{x:Static P.QuickCheck}" Value="{PathRef {x:Reference thai}, QuickCheck}" />
        </Factory>

        <Factory x:TypeArguments="UnpackLoader">
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference thai}, TfsUnifier}" />
        </Factory>

        <Factory x:TypeArguments="semi:DerivationToMrs">
            <Setter Property="{x:Static P.Vpm}" Value="{PathRef {x:Reference thai}, Vpm}"/>
        </Factory>

    </Sequence>

    <Sequence x:Name="batch_th">

        <!--<x:Reference Name="test_sentences" />-->
        <!--<x:Reference Name="sentences_575" />-->
        <x:Reference Name="bitext_sentences" />

        <x:Reference Name="parse_th" />
    </Sequence>

    <!-- ===================================================================================================================== -->

    <MaxEntModel x:Name="the_maxent_model" Loader="{MaxEntModelLoader redwoods.mem}" />

    <ReppRootModule x:Name="ERG_repp"
                    Content="{ReadFile rpp/tokenizer.rpp}"
                    Calls="xml;ascii;lgt;quotes" />

    <PosTrigramModel x:Name="English_pos_trigram_hmm" Filename="grammars\erg-agree\english-pos.hmm" />

    <PathRef x:Name="ERG" Path="RootElement.NameScope[ERG]">
        <XamlLoadInstance Filename="configs\erg.xml" />
    </PathRef>

    <Sequence x:Name="parse_en">

        <UseTranslation />
        
        <Factory x:TypeArguments="ReppExecutor">
            <Setter Property="{x:Static P.ReppRoot}" Value="{x:Reference ERG_repp}" />
        </Factory>

        <!--<Factory x:TypeArguments="LowercaseFirstWordFirstChar" />-->

        <Factory x:TypeArguments="PosTagger">
            <Setter Property="{x:Static P.PosTrigramModel}" Value="{x:Reference English_pos_trigram_hmm}" />
        </Factory>

        <Factory x:TypeArguments="MappingTokenBuilder">
            <Setter Property="{x:Static P.EntryMgr}" Value="{PathRef {x:Reference ERG}, EntryMgr}" />
        </Factory>

        <VertexTaggerF />

        <Factory x:TypeArguments="TokenMapper">
            <Setter Property="{x:Static P.EntryMgr}" Value="{PathRef {x:Reference ERG}, EntryMgr}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
        </Factory>

        <TokenMappingLatticeAdapterF />

        <Factory x:TypeArguments="MorphologyExecutor">
            <Setter Property="{x:Static P.Lexicon}" Value="{PathRef {x:Reference ERG}, EntryMgr.Lexicon}" />
            <Setter Property="{x:Static P.QuickCheck}" Value="{PathRef {x:Reference ERG}, QuickCheck}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
        </Factory>

        <Factory x:TypeArguments="ChartDependenciesLoader">
            <Setter Property="{x:Static P.AgreeConfig}" Value="{PathRef {x:Reference ERG}, AgreeConfig}" />
            <Setter Property="{x:Static P.Isometrics}" Value="{PathRef {x:Reference ERG}, Isometrics}" />
        </Factory>

        <Factory x:TypeArguments="VerifyCoverageLoader" />

        <Factory x:TypeArguments="LexicalFilterLatticeBuilder" />

        <Factory x:TypeArguments="LexicalFilterExecutor">
            <Setter Property="{x:Static P.EntryMgr}" Value="{PathRef {x:Reference ERG}, EntryMgr}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
        </Factory>

        <ChartObjLatticeExtractorF />

        <Factory x:TypeArguments="ParseControl">
            <Setter Property="{x:Static P.AgreeConfig}" Value="{PathRef {x:Reference ERG}, AgreeConfig}" />
            <Setter Property="{x:Static P.ChartConfig}" Value="{PathRef {x:Reference ERG}, AgreeConfig.Parser.Chart}" />
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
            <Setter Property="{x:Static P.ChartStartSymbols}">
                <x:Array Type="StartSymbol">
                    <PathRef Item="{x:Reference ERG}" Path="EntryMgr.ParserStartSymbols[root_strict]" />
                    <PathRef Item="{x:Reference ERG}" Path="EntryMgr.ParserStartSymbols[root_informal]" />
                    <PathRef Item="{x:Reference ERG}" Path="EntryMgr.ParserStartSymbols[root_frag]" />
                    <PathRef Item="{x:Reference ERG}" Path="EntryMgr.ParserStartSymbols[root_inffrag]" />
                </x:Array>
            </Setter>
            <Setter Property="{x:Static P.QuickCheck}" Value="{PathRef {x:Reference ERG}, QuickCheck}" />
        </Factory>

        <Factory x:TypeArguments="UnpackLoader">
            <Setter Property="{x:Static P.TfsUnifier}" Value="{PathRef {x:Reference ERG}, TfsUnifier}" />
        </Factory>

        <Factory x:TypeArguments="ScorerLoader">
            <Setter Property="{x:Static P.MaxEntModel}" Value="{x:Reference the_maxent_model}" />
        </Factory>

        <!--<Factory x:TypeArguments="BatchScorer">
            <Setter Property="{x:Static P.MaxEntModel}" Value="{x:Reference the_maxent_model}" />
            <Setter Property="TopN" Value="1" />
        </Factory>-->

        <Factory x:TypeArguments="semi:DerivationToMrs">
            <Setter Property="{x:Static P.Vpm}" Value="{PathRef {x:Reference ERG}, Vpm}"/>
        </Factory>

    </Sequence>

    <Sequence x:Name="batch_en">

        <!--<x:Reference Name="sentences_575" />-->
        <x:Reference Name="bitext_sentences" />
        
        <x:Reference Name="parse_en" />
    </Sequence>

    <First x:Name="en_best_mrs">
        <x:Reference Name="parse_en" />
    </First>

    <!-- ===================================================================================================================== -->

    <Sequence x:Name="paired_batch">

        <!--<x:Reference Name="sentences_575" />-->
        <x:Reference Name="bitext_sentences" />

        <Factory x:TypeArguments="EnabledItems2" />

        <!--<Factory x:TypeArguments="MrsPairingGrouper">
            <Setter Property="GroupFunctor" Value="{x:Reference parse_th}" />
            <Setter Property="KeyFunctor" Value="{x:Reference en_best_mrs}" />
        </Factory>
        <Factory x:TypeArguments="SelectIsomorphicMrs" />-->
        <!--<DerivationPairingGrouper GroupFunctor="{x:Reference parse_th}" KeyFunctor="{x:Reference en_best_mrs}" />-->

        <!--<MrsPairingGrouper GroupFunctor="{x:Reference parse_th}" KeyFunctor="{x:Reference en_best_mrs}" />-->

        <!--<Factory x:TypeArguments="MrsGroupKeyMultiplier">
            <Setter Property="GroupFunctor" Value="{x:Reference parse_th}" />
            <Setter Property="KeyFunctor" Value="{x:Reference en_best_mrs}" />
        </Factory>

        <Map>

            <Factory x:TypeArguments="PrepareAlignmentMatrix" />

            <Factory x:TypeArguments="SvdExecutor" />

        </Map>-->

        <!--<PrepareAlignmentMatrix />-->

        <!--<SelectIsomorphicMrs />-->

        <!--<Factory x:TypeArguments="PassthroughPairTransfer" />-->

        <PairedItemsExecutor FunctorX="{x:Reference parse_th}" FunctorY="{x:Reference parse_en}" />

        <PairedItemsProcessing />

    </Sequence>

</Workspace>
